home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / sql_data / sql2 / sql_titl.frm (.txt) next >
Encoding:
Visual Basic Form  |  1994-09-15  |  6.2 KB  |  219 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   5025
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1485
  8.    ClientWidth     =   6570
  9.    Height          =   5430
  10.    Left            =   1035
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5025
  13.    ScaleWidth      =   6570
  14.    Top             =   1140
  15.    Width           =   6690
  16.    Begin TextBox txtAu_fname 
  17.       Height          =   285
  18.       Left            =   240
  19.       TabIndex        =   13
  20.       Top             =   1920
  21.       Width           =   1935
  22.    End
  23.    Begin CommandButton cmdEnd 
  24.       Caption         =   "End"
  25.       Height          =   375
  26.       Left            =   2640
  27.       TabIndex        =   11
  28.       Top             =   4200
  29.       Width           =   1575
  30.    End
  31.    Begin CommandButton cmdMove 
  32.       Caption         =   "Last"
  33.       Enabled         =   0   'False
  34.       Height          =   495
  35.       Index           =   3
  36.       Left            =   4560
  37.       TabIndex        =   10
  38.       Top             =   120
  39.       Width           =   1215
  40.    End
  41.    Begin CommandButton cmdMove 
  42.       Caption         =   "First"
  43.       Enabled         =   0   'False
  44.       Height          =   495
  45.       Index           =   0
  46.       Left            =   600
  47.       TabIndex        =   5
  48.       Top             =   120
  49.       Width           =   1215
  50.    End
  51.    Begin CommandButton cmdMove 
  52.       Caption         =   "Previous"
  53.       Enabled         =   0   'False
  54.       Height          =   495
  55.       Index           =   2
  56.       Left            =   3240
  57.       TabIndex        =   8
  58.       Top             =   120
  59.       Width           =   1215
  60.    End
  61.    Begin CommandButton cmdMove 
  62.       Caption         =   "Next"
  63.       Enabled         =   0   'False
  64.       Height          =   495
  65.       Index           =   1
  66.       Left            =   1920
  67.       TabIndex        =   7
  68.       Top             =   120
  69.       Width           =   1215
  70.    End
  71.    Begin CommandButton cmdLoadDB 
  72.       Caption         =   "Load Database"
  73.       Height          =   375
  74.       Left            =   600
  75.       TabIndex        =   6
  76.       Top             =   4200
  77.       Width           =   1575
  78.    End
  79.    Begin ListBox lstTitles 
  80.       Height          =   1005
  81.       Left            =   600
  82.       TabIndex        =   4
  83.       Top             =   2880
  84.       Width           =   5535
  85.    End
  86.    Begin TextBox txtAuId 
  87.       Height          =   375
  88.       Left            =   4440
  89.       TabIndex        =   3
  90.       Top             =   1440
  91.       Width           =   1935
  92.    End
  93.    Begin TextBox txtAu_LName 
  94.       Height          =   285
  95.       Left            =   240
  96.       TabIndex        =   1
  97.       Top             =   1080
  98.       Width           =   1935
  99.    End
  100.    Begin Label Label1 
  101.       BackColor       =   &H00C0C0C0&
  102.       Caption         =   "Author's Last Name"
  103.       FontBold        =   -1  'True
  104.       FontItalic      =   0   'False
  105.       FontName        =   "MS Sans Serif"
  106.       FontSize        =   12
  107.       FontStrikethru  =   0   'False
  108.       FontUnderline   =   0   'False
  109.       Height          =   255
  110.       Index           =   1
  111.       Left            =   240
  112.       TabIndex        =   12
  113.       Top             =   1560
  114.       Width           =   2415
  115.    End
  116.    Begin Label Label3 
  117.       BackColor       =   &H00C0C0C0&
  118.       Caption         =   "Titles"
  119.       FontBold        =   -1  'True
  120.       FontItalic      =   0   'False
  121.       FontName        =   "MS Sans Serif"
  122.       FontSize        =   12
  123.       FontStrikethru  =   0   'False
  124.       FontUnderline   =   0   'False
  125.       Height          =   255
  126.       Left            =   600
  127.       TabIndex        =   9
  128.       Top             =   2400
  129.       Width           =   2175
  130.    End
  131.    Begin Label Label2 
  132.       BackColor       =   &H00C0C0C0&
  133.       Caption         =   "Author ID"
  134.       FontBold        =   -1  'True
  135.       FontItalic      =   0   'False
  136.       FontName        =   "MS Sans Serif"
  137.       FontSize        =   12
  138.       FontStrikethru  =   0   'False
  139.       FontUnderline   =   0   'False
  140.       Height          =   255
  141.       Left            =   4440
  142.       TabIndex        =   2
  143.       Top             =   960
  144.       Width           =   1815
  145.    End
  146.    Begin Label Label1 
  147.       BackColor       =   &H00C0C0C0&
  148.       Caption         =   "Author's Last Name"
  149.       FontBold        =   -1  'True
  150.       FontItalic      =   0   'False
  151.       FontName        =   "MS Sans Serif"
  152.       FontSize        =   12
  153.       FontStrikethru  =   0   'False
  154.       FontUnderline   =   0   'False
  155.       Height          =   255
  156.       Index           =   0
  157.       Left            =   240
  158.       TabIndex        =   0
  159.       Top             =   720
  160.       Width           =   2415
  161.    End
  162. Option Explicit
  163. Dim db As database
  164. Dim dsau As dynaset
  165. Dim dsTi As dynaset
  166. Sub cmdLoadDB_Click ()
  167. Dim dsconnect As String
  168. Dim cnt As Integer
  169. screen.MousePointer = 11
  170. dsconnect$ = "ODBC;DSN=MYSQL;DATABASE=pubs;UID=SA;PWD=;"
  171. Set db = OpenDatabase("", False, False, dsconnect$)
  172. Set dsau = db.CreateDynaset("Select au_id,au_lname,au_fname from authors")
  173. Call PD
  174. Call TD
  175. For cnt = 0 To 3
  176.     cmdMove(cnt).Enabled = True
  177. screen.MousePointer = 0
  178. End Sub
  179. Sub cmdMove_Click (index As Integer)
  180. Select Case index
  181.     Case 0
  182.         dsau.MoveFirst
  183.     Case 1
  184.         dsau.MoveNext
  185.         If dsau.EOF Then
  186.             MsgBox "You have reached the end of file."
  187.             dsau.MoveLast
  188.         End If
  189.     Case 2
  190.         dsau.MovePrevious
  191.         If dsau.BOF Then
  192.             MsgBox "You have reached the beginning of file."
  193.             dsau.MoveFirst
  194.         End If
  195.     Case 3
  196.         dsau.MoveLast
  197. End Select
  198. screen.MousePointer = 11
  199. Call PD
  200. Call TD
  201. screen.MousePointer = 0
  202. End Sub
  203. Sub PD ()
  204. txtAu_FName.Text = dsau!au_fname
  205. txtAu_LName.Text = dsau!au_lname
  206. txtAuID.Text = dsau!au_ID
  207. End Sub
  208. Sub TD ()
  209. Dim sql As String
  210. Dim au As String
  211. au$ = txtAuID.Text
  212. sql$ = "Select title from titles, titleauthor where titleauthor.au_id = '" & au$ & "' and titleauthor.title_id = titles.title_id"
  213. Set dsTi = db.CreateDynaset(sql$)
  214. lsttitles.Clear
  215. Do Until dsTi.EOF
  216.     lsttitles.AddItem dsTi!title
  217.     dsTi.MoveNext
  218. End Sub
  219.